home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1989 / Sep 89 / Y0080-TCluster enhancemen-Sep89 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.0 KB  |  70 lines  |  [TEXT/GEOL]

  1. Item    1674726                         25-Sept-89        21:22
  2.  
  3. From:   KNEPPER                         Knepper, Christopher
  4.  
  5. To:     MACAPP.TECH$                    MACAPP Tech
  6.         MACAPP.TEST                     MacApp SQA Team
  7.  
  8. Sub:    TCluster enhancement
  9.  
  10. TCluster should have a SetCurrent method to complement ReportCurrent.
  11.  
  12.    PROCEDURE TCluster.SetCurrent(id:IDType; redraw:boolean);
  13.  
  14. Example: It might be used in an application's preferences dialog, in which
  15. the identifier of the radio button selected in a preferences dialog is
  16. stored with the application (eg. in a resource):
  17.  
  18. {-----------------------------------------------------------------------------}
  19. {$S ARes}
  20.  
  21. FUNCTION TMyApplication.Preferences(id:IDType):IDType;
  22.    VAR
  23.     aWindow:   TWindow;
  24.     aDialog:   TDialogView;
  25.     aCluster:  TCluster;
  26.     dismisser: IDType;
  27.    BEGIN
  28.     aWindow := NewTemplateWindow(kMyDialog, NIL);
  29.     FailNIL(aWindow);
  30.     aDialog := TDialogView(aWindow.FindSubView('Dlog'));
  31.     FailNIL(aDialog);
  32.     aCluster := TCluster(aDialog.FindSubView('Clst'));
  33.     FailNIL(aCluster);
  34.     aCluster.SetCurrent(id, kDontRedraw);  { !!! SetCurrent !!! }
  35.     dismisser := aDialog.PoseModally;
  36.     IF dismisser = 'A-OK' THEN
  37.         Preferences := aCluster.ReportCurrent
  38.     ELSE
  39.         Preferences := id; { return original setting }
  40.    END;
  41.  
  42. {-----------------------------------------------------------------------------}
  43.  
  44. This is my initial effort at coding such a method:
  45.  
  46. {-----------------------------------------------------------------------------}
  47. {$S DlgRes}
  48.  
  49. PROCEDURE TCluster.SetCurrent(id:IDType; redraw:boolean);
  50.  
  51.    PROCEDURE SetRadioByID(theSubView: TView);
  52.    BEGIN
  53.    IF Member(theSubView,TRadio) THEN
  54.    BEGIN
  55.    IF (theSubView.fIdentifier = id) THEN
  56.    TRadio(theSubView).SetState(TRUE,redraw)
  57.    ELSE
  58.    TRadio(theSubView).SetState(FALSE,redraw);
  59.    END;
  60.    END;
  61.  
  62.    BEGIN
  63.    EachSubView(SetRadioByID);
  64.    END;
  65.  
  66. {-----------------------------------------------------------------------------}
  67.  
  68. -Chris
  69.  
  70.